/* usrdef.h
 *
 * Holds function definitions of a hash table of user defined data types
 *
 */

#ifndef USRDEF_H
#define USRDEF_H

#include <stdio.h>
#include "shared.h"
#include "error.h"
#include <string.h>




/* ----------------------------------------------------------------
 * Data type definitions
 * ----------------------------------------------------------------
 */

struct usrdef_t{
  char *name;
  int scope;
  struct type_denoter_t *td;
  struct usrdef_t *next;
  int line_number;
  int seen_at_least_once;
  long size;
};


#define USRDEF_NEW_ANONYMOUS_NAME_PREFIX "__usrdef_"


/* ----------------------------------------------------------------
 * Function declarations
 * ----------------------------------------------------------------
 */

struct usrdef_t *usrdef_insert(char *lexeme, int line_number);
struct usrdef_t *usrdef_lookup(char *lexeme);
struct usrdef_t *usrdef_new();
char *usrdef_new_name();
void usrdef_init();
void usrdef_print();
void usrdef_print_type_denoter(struct type_denoter_t *td, int numOfTabs);
void usrdef_print_basetype(struct type_denoter_t *td, int numOfTabs);
void usrdef_print_array_type(struct type_denoter_t *td, int numOfTabs);
void usrdef_print_record_section_list(struct type_denoter_t *td, int numOfTabs);
void usrdef_compute_sizes();


#endif

